' This is the code to emulate a vt100 and interface to the windows API
'
' Charles McGuinness [76701,11]
'
'
Dim curx As Integer
Dim cury As Integer
Dim curpx As Integer
Dim curpy As Integer
Dim InEscape As Integer ' Processing an escape seq?
Dim EscString As String ' String so far
Dim CharHeight As Integer
Dim CharWidth As Integer
Dim CurState As Integer
Dim ttyhdc As Integer
Declare Function BitBlt Lib "GDI" (ByVal hDestDC As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal XSrc As Integer, ByVal YSrc As Integer, ByVal dwRop As Long) As Integer
' Ternary raster operations
Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
Const SRCPAINT = &HEE0086 ' (DWORD) dest = source OR dest
Const SRCAND = &H8800C6 ' (DWORD) dest = source AND dest
Const SRCINVERT = &H660046 ' (DWORD) dest = source XOR dest
Const SRCERASE = &H440328 ' (DWORD) dest = source AND (NOT dest )
Const NOTSRCCOPY = &H330008 ' (DWORD) dest = (NOT source)
Const NOTSRCERASE = &H1100A6 ' (DWORD) dest = (NOT src) AND (NOT dest)
Const MERGECOPY = &HC000CA ' (DWORD) dest = (source AND pattern)
Const MERGEPAINT = &HBB0226 ' (DWORD) dest = (NOT source) OR dest
Const PATCOPY = &HF00021 ' (DWORD) dest = pattern
Const PATPAINT = &HFB0A09 ' (DWORD) dest = DPSnoo
Const PATINVERT = &H5A0049 ' (DWORD) dest = pattern XOR dest
Const DSTINVERT = &H550009 ' (DWORD) dest = (NOT dest)
Const BLACKNESS = &H42& ' (DWORD) dest = BLACK
Const WHITENESS = &HFF0062 ' (DWORD) dest = WHITE
'
' Calls to output text
'
Declare Function TextOut Lib "GDI" (ByVal hdc%, ByVal x%, ByVal y%, ByVal lpString$, ByVal nCount%) As Integer
'
' Set text to transparent or opaque
'
Declare Function SetBkMode Lib "GDI" (ByVal hdc%, ByVal nmode%) As Integer
Const TRANSPARENT = 1
Const OPAQUE = 2
'
' Color management
'
Declare Function GetTextColor Lib "GDI" (ByVal hdc%) As Long
Declare Function SetTextColor Lib "GDI" (ByVal hdc%, newcolor As Long) As Long
Declare Function GetBkColor Lib "GDI" (ByVal hdc%) As Long
Declare Function SetBkColor Lib "GDI" (ByVal hdc%, newcolor As Long) As Long
Dim ScrImage(0 To 23) As String * 80
''' Removed to improve speed ''' Dim ScrAttr(0 to 23) As String * 80
Dim Normal80 As String
''' Removed to improve speed ''' Dim CurAttr As String
'
' Current Buffered Text
'
Dim outstr As String
Dim outx As Integer
Dim outlen As Integer
'
' Flag to indicate that we're ready to run
'
Dim FlagInit As Integer
Sub term_init ()
curx = 0
cury = 0
curpx = 0
curpy = 0
InEscape = 0
CurState = 0
outx = curpx
outstr = ""
outlen = 0
CharHeight = tty.TextHeight("M")
CharWidth = tty.TextWidth("M")
r% = SetBkMode(tty.hdc, OPAQUE)
disp_cursor
''' Removed to improve speed ''' Normal80 = String$(80, "0")
For i% = 0 To 23
ScrImage(i%) = Space$(80)
''' Removed to improve speed ''' ScrAttr(i%) = Normal80